﻿// 开发者:micropu
// 公司:佛山远钧智慧科技有限公司

using Admin.NET.Application.Service.Device.Dto;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TouchSocket.Http.WebSockets;

namespace Admin.NET.Application.SysncService.PlatFormSync;
public interface IPlatFormJobManager
{
    /// <summary>
    /// 返回所有设备
    /// </summary>
    /// <returns></returns>
    ConcurrentDictionary<string, PassDevice> SelectAllDevices();

    /// <summary>
    /// 根据设备SN获取设备
    /// </summary>
    /// <param name="deviceSn"></param>
    /// <returns></returns>
    PassDevice GetDevice(string deviceSn);
    /// <summary>
    /// 添加设备
    /// </summary>
    /// <param name="deviceSn"></param>
    /// <param name="device"></param>
    void AddDevice(string deviceSn, PassDevice device);
    /// <summary>
    /// 移除设备
    /// </summary>
    /// <param name="deviceSn"></param>
    void RemoveDevice(string deviceSn);

    /// <summary>
    /// 是否正在运行
    /// </summary>
    /// <returns></returns>
    bool isRunning();

    /// <summary>
    /// 设置running
    /// </summary>
    /// <param name="running"></param>
    void setRunning(bool running);

    /// <summary>
    /// 信号量，用于控制并发访问
    /// </summary>
    /// <returns></returns>
    SemaphoreSlim semaphore();

    /// <summary>
    /// 释放信号量
    /// </summary>
    void semaphoreRelease();

    /// <summary>
    /// 平台在线设备字典
    /// </summary>
    /// <returns></returns>
    ConcurrentDictionary<string, PassDevice> PlatformOnlineDevicesDic();
}
